package lime49.lockcrypt.mobile;
import java.util.*;
import j2me.util.LinkedHashMap;

public class AccType {
    public String name, notes;
    public LinkedHashMap fieldmap;
    public boolean showNotes;
    
    public AccType(String name, LinkedHashMap fieldmap, boolean showNotes, String notes) {
        // Used when this object hold the hasmap of fields<>fieldvals for an account
        this.name = name;
        this.fieldmap = fieldmap;
        this.showNotes = showNotes;
        this.notes = Utils.replace(notes, "_N_","\n");
    }
    
    public String getName() {
        return name;
    }
   
    public String getField(String name) {
        return (String)fieldmap.get(name);
    }
    
    public LinkedHashMap getFieldMap() {
        return fieldmap;
    }
    
        /**
     * Gets the notes for this account type
     * @return The notes for this account type
     */
    public String getNotes() {
        return notes;
    }
    
    /**
     * Finds whether or not to show the notes field for this account type
     * @return True if the notes field is enabled, otherwise false
     */
    public boolean getShowNotes() {
        return showNotes;
    }
    
    public String getSearchString() {
        //return fieldmap.values().toString();
        return "";
    }
    
    public int compareTo(Object otherObj) {
        AccType otherType = (AccType)otherObj;
        return name.toLowerCase().compareTo(otherType.getName().toLowerCase());
    }

}
